package game.display;

import java.awt.Color;
import java.awt.Graphics;

public class HealthBar {
	private static final int OFFSET = 10;
	private static final int HEIGHT = 8;
	private static final int WIDTH = 64;
	private static final int HEALTH_HEIGHT = 6;
	
	public static void updateHealthBar(Graphics g, double xLoc, double yLoc, double health, double maxHealth){
		g.setColor(Color.white);
		g.fillRect((int)xLoc, (int)yLoc-OFFSET, (int)WIDTH, HEIGHT);
		if(health/maxHealth < .25)g.setColor(Color.red);
		else if(health/maxHealth < .5)g.setColor(Color.yellow);
		else g.setColor(Color.green);
		g.fillRect((int)xLoc, (int)yLoc-OFFSET+1, (int)(WIDTH*(health/maxHealth)), HEALTH_HEIGHT);
	}
}
